fp = open("Walden.txt",encoding="utf-8")
word = {}
# print(fp.read())

for line in fp:
    line = line[0:-1]
    line = line.lower()
    line = line.replace("0"," ")
    line = line.replace("1", " ")
    line = line.replace("2", " ")
    line = line.replace("3", " ")
    line = line.replace("4", " ")
    line = line.replace("5", " ")
    line = line.replace("6", " ")
    line = line.replace("7", " ")
    line = line.replace("8", " ")
    line = line.replace("9", " ")
    line = line.replace(".", " ")
    line = line.replace("-", " ")
    line = line.replace(",", " ")
    line = line.replace("\"", " ")
    line = line.replace(";", " ")
    line = line.replace("?", " ")
    line = line.replace("$", " ")
    line = line.replace("+", " ")
    line = line.replace("/", " ")
    line = line.replace("‘", " ")
    line = line.replace("!", " ")
    line = line.replace(":", " ")
    lst_line = line.split(" ")
    for words in lst_line:
        if words.isalpha() and words in word:
            word[words] += 1
        elif words.isalpha() and words not in word:
            word[words] = 1

print(word)


